#ifndef SHORTCUTDELEGATE_H
#define SHORTCUTDELEGATE_H

#include <QObject>
#include <QStyledItemDelegate>
#include <QSize>
#include <QModelIndex>
#include <QPointer>

#include "shortcutwidget.h"

class SizeHintHelper;



class ShortcutDelegate : public QStyledItemDelegate
{
		Q_OBJECT
	public:

		explicit ShortcutDelegate(QObject *parent = 0);

		~ShortcutDelegate();

		QWidget *createEditor(QWidget *parent,
		                      const QStyleOptionViewItem &option,
		                      const QModelIndex &index) const;

		void setEditorData(QWidget* editor, const QModelIndex& index) const;
		void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;

		QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;

		void writeEditorToModel();

	signals:

		void editorDisplayed(int index) const;
		void editorClosed(int index) const;

	public slots:

	private slots:

		//void onEditorDestroyed();


	private:

		SizeHintHelper* _sizeHintHelper;
};

#endif // SHORTCUTDELEGATE_H
